package cz.cuni.mff.ufal.volk.patterns;

import java.io.IOException;
import java.io.InputStream;

import alice.tuprolog.Library;
import alice.tuprolog.Theory;

/**
 * tuProlog library used for evaluating the patterns.
 * 
 * @author Bartłomiej Etenkowski
 */
public class PatternLibrary extends Library {
	private static final long serialVersionUID = -1846646149430240139L;

	@Override
	public String getName() {
		return "cz.cuni.mff.ufal.volk.patterns.PatternLibrary";
	}

	private static Theory patternTheory;
	private static String patternTheoryString;
	static {
		InputStream in = PatternLibrary.class.getResourceAsStream("/pl/PatternLibrary.pl");
		try {
			try {
				patternTheory = new Theory(in);
				patternTheoryString = patternTheory.toString();
			} finally {
				in.close();
			}
		} catch (IOException e) {
			throw new RuntimeException("An IOException occurred while trying to initialize PatternLibrary", e);
		}
	}

	@Override
	public String getTheory() {
		return patternTheoryString;
	}

}
